<?php
namespace app\common\model;

class SettingModel extends Model {
	
	protected $table = 'setting';
	protected $id = 'id';
	protected $type = array(
		'id' => 'integer',
		'name' => 'string',
		'describe' => 'string',
		'value' => 'string',
		'update_time' => 'integer',
		'sort' => 'integer',
	);
	
	protected static $fields = array(
		2 => 'app_name',
		1 => 'manager_phone',
	);
	public static function getFieldsId($name) {
		
		$id = null;
		foreach(self::$fields as $key => $value){
			if($value === $name){
				$id = $key;
				break;
			};
		};
		return $id;
	}
	
	public function getFieldsName() {
		
		$name = null;
		foreach(self::$fields as $key => $value){
			if($key === $this->getData('id')){
				$name = $value;
				break;
			};
		};
		return $name;
	}

}